package com.qf.day05;

import java.util.Random;

/**
 * 编写类时，注意，类名的首字母一定要大写
 * 类中可以写属性和方法
 * <p>
 * 学生的属性：姓名性别，年龄，身高，体重，肤色，学习市场，代码行数，心情值
 * 学生行为：跑步，吃饭，睡觉，玩游戏，写代码，上课
 */
public class Student {
    String name;
    String sex;
    int age;
    double height;
    double weight;
    String color = "yellow";
    //构造方法
    public Student(String name, String sex, int age, double height, double weight, String color, int studyHours, int codeLineNum, int happy, int devAbility) {
        this.name = name;
        this.sex = sex;
        this.age = age;
        this.height = height;
        this.weight = weight;
        this.color = color;
        this.studyHours = studyHours;
        this.codeLineNum = codeLineNum;
        this.happy = happy;
        this.devAbility = devAbility;
    }
    //无参构造
    public Student() {
    }

    int studyHours;
    int codeLineNum;
    int happy;
    int devAbility; //开发能力

    public void run() {
        Random random = new Random();
        int time = random.nextInt(60) + 1;
        System.out.println(name + "在跑步" + time);
        weight = weight - 1;  //跑步减轻体重
        happy = happy + 1;
    }

    public void playGame() {
        System.out.println(name + "玩游戏");
        Random random = new Random();
        int time = random.nextInt(60) + 1;
        if (time > 30) {
            devAbility = devAbility - 10;
            happy = happy - 10;
            System.out.println(name+"玩游戏，玩太久了，很内疚，心情值为"+happy+"开发能力为"+devAbility);
        } else {
            happy = happy + 10;
            System.out.println("小玩怡情");
        }

    }
}
